/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yinsh
 * Date: 2025-01-12
 * Time: 19:54
 */
public class Student implements Comparable,ageComparator,nameComparator{
    public String name;
    public int age;

    @Override
    public int ageComparator(Object o) {
        return this.age - ((Student)o).age;
    }

    @Override
    public int nameComparator(Object o) {
            return this.compareTo((Student)o);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(Object o) {
        return this.age - ((Student)o).age;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
